package com.comment.controller;

import com.comment.entity.ClientComments;
import com.comment.service.IClientCommentsService;
import com.common.untils.CommonResult;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author pgx
 * @since 2022-09-09
 */
@RestController
    @RequestMapping("/comment/clientComments")
public class ClientCommentsController {
    @Autowired
    private IClientCommentsService service;

    @PostMapping("selectAll/{goodsId}/{shopId}")
    public CommonResult selectAll(@PathVariable String goodsId,@PathVariable String shopId){
       return service.selectAll(goodsId,shopId);
    }
    @PostMapping("insertComment")
    public CommonResult insertComment(@RequestBody ClientComments clientComments, HttpServletRequest request){
        String hometoken = request.getHeader("hometoken");
        System.out.println(clientComments);
        return service.insertComment(clientComments,hometoken);
    }
}
